package Game;

import java.awt.Graphics2D;
import java.awt.event.KeyEvent;

import Game.Keyboard.KeyState;

public class Menu extends Scene
{
	enum MenuScreen
	{
		MAIN,
		INSTRUCTIONS,
	}
	
	MenuScreen actualScreen;
	
	GameImage mainButton;
	
	public Menu()
	{
		System.out.println("Menu");
		background = new GameImage(0, 0);
		background.Load("/Images/bg_menu.png");
		actualScreen = MenuScreen.MAIN;
		
		mainButton = new GameImage((int)(TowerDefense.screenWidth * 0.48f), (int)(TowerDefense.screenHeight * 0.75f), "/Images/btn_comecar.png");
	}
	
	@Override
	public void Update()
	{
		switch(actualScreen)
		{
		case MAIN:
			
			if(Mouse.clicked)
			{
				this.actualScreen = MenuScreen.INSTRUCTIONS;
			}
			
			else if(Keyboard.GetKeyState(KeyEvent.VK_ENTER) == KeyState.PRESSED_ONCE)
			{
				this.actualScreen = MenuScreen.INSTRUCTIONS;
			}
			
			if(Keyboard.GetKeyState(KeyEvent.VK_ESCAPE) == KeyState.PRESSED_ONCE)
			{
				System.exit(0);
			}
			
			break;
		case INSTRUCTIONS:
			
			if(Mouse.clicked)
			{
				SceneManager.ChangeScene();
			}
			
			if(Keyboard.GetKeyState(KeyEvent.VK_ENTER) == KeyState.PRESSED_ONCE)
			{
				SceneManager.ChangeScene();
			}
			
			break;
		}
	}

	@Override
	public void Draw(Graphics2D g2d) 
	{
		background.Draw(g2d);
		
		switch(actualScreen)
		{
		case MAIN:
			mainButton.Draw(g2d);
			break;
		case INSTRUCTIONS:
			
			break;
		}
	}
}
